import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:pornhub_app/assets/styles.dart';
import 'package:pornhub_app/components/image_view.dart';
import 'package:pornhub_app/components/text_view.dart';
import 'package:pornhub_app/model/engagement/engagement_model.dart';
import 'package:pornhub_app/routes/routes.dart';
import 'package:pornhub_app/utils/extension.dart';

class EngagementListCell extends StatelessWidget {
  EngagementModel data;

  EngagementListCell({super.key, required this.data});

  @override
  Widget build(BuildContext context) {
    return Stack(
      children: <Widget>[
        ImageView(
          src: data.logo ?? '',
          width: MediaQuery.of(context).size.width,
          height: MediaQuery.of(context).size.width,
          borderRadius: Styles.borderRaidus.xs,
        ),
        Positioned(
            left: 0,
            right: 0,
            bottom: 0,
            child: ClipRRect(
              borderRadius: BorderRadius.only(
                bottomLeft: Radius.circular(4.r),
                bottomRight: Radius.circular(4.r),
              ),
              child: Image(
                image: const AssetImage(
                    'assets/engagement/icon_engagement_shadow.png'),
                width: MediaQuery.of(context).size.width,
                height: 100.w,
              ),
            )),
        Positioned(
            left: 0,
            right: 0,
            bottom: 0,
            child: Padding(
              padding: EdgeInsets.all(10.w),
              child: Column(
                crossAxisAlignment: CrossAxisAlignment.start,
                children: <Widget>[
                  TextView(
                    text: data.nickName ?? '',
                    color: Colors.white,
                    fontSize: 13.w,
                    maxLines: 1,
                    overflow: TextOverflow.ellipsis,
                  ),
                  SizedBox(height: 2.w),
                  Row(
                    children: <Widget>[
                      Image.asset(
                        'assets/engagement/icon_engagement_location.png',
                        width: 8.w,
                        height: 10.w,
                      ),
                      SizedBox(width: 1.w),
                      TextView(
                        text: data.cityName ?? '',
                        color: Colors.white,
                        fontSize: 10.w,
                      ),
                    ],
                  ),
                  SizedBox(height: 1.w),
                  TextView(
                    text: '${data.serviceTags?.join(',')}',
                    color: Colors.white,
                    fontSize: 11.w,
                    maxLines: 1,
                    overflow: TextOverflow.ellipsis,
                  ),
                ],
              ),
            )),
        Positioned(
          left: 0,
          top: 0,
          right: 0,
          bottom: 0,
          child: Visibility(
              maintainSize: false,
              maintainAnimation: true,
              maintainState: true,
              maintainInteractivity: false,
              visible: data.videoCert == true,
              child: Center(
                child: Image.asset(
                  'assets/engagement/icon_video_play.png',
                  width: 30.w,
                  height: 30.w,
                ),
              )),
        ),
        Positioned(
          top: -2,
          right: 0,
          child: Visibility(
              maintainSize: false,
              maintainAnimation: true,
              maintainState: true,
              maintainInteractivity: false,
              visible: data.officialCert == true,
              child: Image.asset(
                'assets/engagement/icon_official_certification.png',
                width: 68.w,
                height: 18.w,
              )),
        ),
      ],
    ).marginOnly(left: 14.w, bottom: 14.w, right: 14.w).onOpaqueTap(() {
      Get.toEngagementDetail(meetUserId: data.meetUserId ?? 0);
    });
  }
}
